<table>
  <tr>
    <td width="30%">
      <%= form_remote_tag(:update => 'sandbox', :url => {:controller => "index", :action => :sandboxbuy} ) %>
      <table>
        <tr>
          <td><label for="operation_account">Account</label></td>
          <td><%= select( 'operation', 'account_id', Accounts.find_all.collect {|account| [account.name + " (" + sprintf("%0.2f \%", account.brokerage_percents) + ")" , account.id]})  %></td>
        </tr>
        <tr>
          <td><label for="operation_quantity">Quantity</label></td>
          <td><%= text_field 'operation', 'quantity', 'size' => 5 %></td>
        </tr>
        <tr>
          <td><label for="operation_price">Price</label></td>
          <td><%= text_field 'operation', 'price', 'size' => 5  %></td>
        </tr>
        <% if @operation %>
        <tr>
          <td><label for="operation_net_amount">Net Amount</label></td>
          <td><%= sprintf("%0.2f", @operation.net_amount) %></td>
            </tr>
        <tr>
          <td><label for="operation_net_amount">Brockerage</label></td>
          <td><%= sprintf("%0.2f", @operation.brokerage) %></td>
            </tr>
        <tr>
          <td><label for="operation_net_amount">Gross Amount</label></td>
          <td><%= sprintf("%0.2f", @operation.gross_amount) %></td>
        </tr>
        <% end %>
        <tr>
          <td>&nbsp;</td>
          <td><%= submit_tag "Simulate buying" %></td>
        </tr>
      </table>

      <%= end_form_tag %>

    </td>
    <td width="10%">&nbsp;</td>
    <td width="60%" valign="top">
      <%= form_remote_tag(:update => 'sandbox', :url => { :action => :sandboxsell} ) %>
      <% if @operation %>
      <%= render 'index/calc' %>
      <% end %>
      <%= end_form_tag %>
    </td>
  </tr>
</table>
